#pragma once

#include "WinCore.h"

//////////////////////////////////////////////////////////////////////////
// CDemoApp
//////////////////////////////////////////////////////////////////////////
class CDemoApp : public CWinApp
{
public:
	CDemoApp();
	~CDemoApp();

protected:
	bool	InitInstance();
};

//////////////////////////////////////////////////////////////////////////
// CDemoWnd
//////////////////////////////////////////////////////////////////////////
class CDemoWnd : public CWinWnd
{
protected:
	struct TMSGMAP {
		typedef LRESULT (CDemoWnd::*MSGPROC)(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

		UINT		m_nMsg;
		MSGPROC		m_MsgProc;
	};

public: 
	CDemoWnd();
	~CDemoWnd();

protected:
	LRESULT		WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

protected:
	LRESULT		OnCreate(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnDestroy(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnPaint(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnLButtonDown(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnTimer(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

private:
	void		DrawRectangle(HDC hDC, const RECT& rtGrid, COLORREF clrLine = RGB(0, 0, 0));
	void		DrawMarkInfo(HDC hDC, const RECT& rtGrids, int nIndex, const TCHAR* szMarkInfo,  COLORREF clrText = RGB(128, 128, 128));

	void		DemoDCInfo(HDC hDC, const RECT& rtGrid);
	void		DemoDCDrawing(HDC hDC, const RECT& rtGrid);
	void		DemoDrawingLine(HDC hDC, const RECT& rtGrid);
	void		DemoDrawingText(HDC hDC, const RECT& rtGrid);
	void		DemoDrawingRectangle(HDC hDC, const RECT& rtGrid);
	void		DemoDrawingFillRectangle(HDC hDC, const RECT& rtGrid);

	const RECT&		_ScreenToClient(HWND hWnd, RECT& rtScreen);
	const TCHAR*	_GetLineStyle(UINT nStyle);
	const TCHAR*	_GetBrushStyle(UINT nStyle);
private:
	static const TMSGMAP MsgMapTable[];
};
